package com.hotchpotch.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.TextView;

import com.hotchpotch.R;
import com.hotchpotch.base.BaseFragment;

import butterknife.BindView;

/**
 * Created by Administrator on 2017/8/26 0026.
 */

public class TestFragment extends BaseFragment {
    private static String ARGUMENT = "name";
    private String name = "";
    @BindView(R.id.textview) TextView textView;

    /**构造时把传入的参数带进来*/
    public static TestFragment newInstance(String argument) {
        Bundle bundle = new Bundle();
        bundle.putString(ARGUMENT, argument);
        TestFragment fragment = new TestFragment();
        fragment.setArguments(bundle);
        return fragment;
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Bundle bundle = getArguments();
        if (bundle != null) {
            name = bundle.getString(ARGUMENT);
        }
    }

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_test;
    }

    @Override
    protected void initView(View view) {

    }

    @Override
    protected void initEvents() {

    }

    @Override
    protected void initData() {
        textView.setText(name);
    }
}
